using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;
using KPIS.GERP.Models.HRM;

namespace KPIS.GERP.Models.SYS
{
    [DataContract, Table("SysApprovePath")]
    public class ApprovePath
    {
        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int AppPathId { get; set; }

        [Required, DataMember, ForeignKey("ApproveProcess")]
        public int AppPrcId { get; set; }

		[Required, DataMember, Display(Name = "StepNo", ResourceType = typeof(Resources.ApprovePathResource))]
        public int StepNo { get; set; }

        [DataMember]
        public virtual ApproveProcess ApproveProcess { get; set; }

        [DataMember, Display(Name = "ApproverType", ResourceType = typeof (Resources.ApprovePathResource))]
        public virtual ApproverType ApproverType { get; set; }

        [DataMember]
        public virtual bool IsPassApproveLine { get; set; }
        
        [DataMember]
        public virtual bool IsForNotice { get; set; }

        /*
        [DataMember]
        public virtual bool IsApproveAble { get; set; }

        [DataMember]
        public virtual bool IsForwardable { get; set; }

        [DataMember]
        public virtual bool IsRejectable { get; set; }

        [DataMember]
        public virtual bool IsPendable { get; set; }

        [DataMember]
        public virtual bool IsSendBackable { get; set; }

        [DataMember]
        public virtual bool IsLockable { get; set; }
         * 
         
        [DataMember, Display(Name = "AmountMin", ResourceType = typeof (Resources.ApprovePathResource))]
        public virtual decimal? AmountMin { get; set; }

        [DataMember, Display(Name = "AmountMax", ResourceType = typeof (Resources.ApprovePathResource))]
        public virtual decimal? AmountMax { get; set; }
         */

        [DataMember, ForeignKey("ExecutivePosition")]
        public int? ExecPosId { get; set; }

        [DataMember, ForeignKey("Position"), Display(Name = "PosId", ResourceType = typeof (Resources.ApprovePathResource))]
        public virtual int? PosId { get; set; }

        [DataMember]
        public virtual ExecutivePosition ExecutivePosition { get; set; }

        [DataMember]
        public virtual Position Position { get; set; }

        /*
        public virtual bool IsPassAmountCondition(decimal? requestAmount)
        {
            if (requestAmount == null && AmountMin != null && AmountMin > 0)
                return false;
            requestAmount = requestAmount ?? 0;

            return AmountMax != null && requestAmount.Value <= AmountMax.Value;
        }*/

        [DataMember]
        public string RecordStatus { get; set; }
    }
}